<template>
  <!-- header -->
  <div class="top-header">
    <div class="left" @click="go_to_back">
      <img src="@/assets/index_images/back.png" alt="">
      <span>{{ this.title }}</span>
    </div>
  </div>
</template>

<script>

export default {
  name: 'NewHeader',
  props: {
    path: {
      type: String,
      default: ''
    },
    title: {
      type: String,
      default: '家庭作业'
    }
  },
  data() {
    return {

    }
  },
  mounted() {

  },
  methods: {
    go_to_back() {
      if (this.path === '') {
        window.history.back()
      } else {
        this.$router.push({ path: this.path })
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.top-header{
  background-color: white;
  overflow: hidden;
  position: absolute;
  top: -70px;
  width: 100%;
  height: 80px;
  line-height: 80px;
  padding: 0 25px;
  left: 0;
  .left{
    cursor: pointer;
    float: left;
    display: flex;
    align-items: center;
    img{
      width: 15px;
    }
    span{
      margin-left: 10px;
      // width: 80px;
      font-size: 20px;
      font-weight: 500;
      color: rgba(0, 0, 0, 0.85);
    }
  }
  .right{
    float: right;
    display: flex;
    align-items: center;
    .right-item{
      margin-right: 20px;
      width: 120px;
    }
    .last{
      color: #1890FF;
      font-size: 14px;
    }

  }

}
</style>
